<h2>Chat Window</h2>
<div id="messages"></div>
<div style="position: absolute; bottom: 25;">
<input type="text" id="text-input">
<input type="button" value="Send" id="send-button">
</div>

<script>
  $(document).ready(function(){
    
    now.receiveMessage = function(name, message){
      $("#messages").append("<br>" + name + ": " + message);
    }
    
    $("#send-button").click(function(){
      now.distributeMessage($("#text-input").val());
      $("#text-input").val("");
      $("#text-input").focus();
    });
    
    $("#text-input").keypress(function (e) {
      if (e.which && e.which === 13) {
        $("#send-button").click();
        return false;
      }
    });
    
    now.name = prompt("What's your name?", "");
    
    $("#text-input").focus();
    
  });
</script>